from odoo import fields, models, _
from odoo.exceptions import UserError

class ReportWorkOrderTimeWizard(models.TransientModel):
    _name = 's.report.work.order.time.wizard'
    _description = 'Report Work Order Time Wizard'

    product_id = fields.Many2one('product.product', string='Product')
    production_id = fields.Many2one('mrp.production', string='Production')

    def action_view(self):
        if not self.product_id and not self.production_id:
            raise UserError(_('Please select at least one condition!'))
        return {
            'name': _('Report Work Order Time'),
            'view_mode': 'tree',
            'res_model': 's.report.work.order.time',
            'type': 'ir.actions.act_window',
            'context': {
                'product_id': self.product_id.id,
                'production_id': self.production_id.id
            },
        }
